package view.recados;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class FormatoCelda extends DefaultTableCellRenderer {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int columna_patron;

	public FormatoCelda(int Colpatron) {
		this.columna_patron = Colpatron;
	}

	@Override
	public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focused, int row, int column) {
		setBackground(Color.white);// color de fondo
		table.setForeground(Color.black);// color de texto
		// Si la celda corresponde a una fila con estado FALSE, se cambia el color de fondo a rojo
		if (table.getValueAt(row, columna_patron).equals("si")) {
			Color color = new Color(245, 222, 179);
			setBackground(color);
		}

//		if (table.getValueAt(row, columna_patron).toString().compareTo(Calendar.getInstance().toString()) == 1) {
//			Color color = new Color(255, 36, 0);
//			setBackground(color);
//		} else if (table.getValueAt(row, columna_patron).toString().compareTo(Calendar.getInstance().toString()) == 0) {
//			Color color = new Color(255, 215, 0);
//			setBackground(color);
//		} else {
//			Color color = new Color(68, 148, 74);
//			setBackground(color);
//		}

		super.getTableCellRendererComponent(table, value, selected, focused, row, column);
		return this;
	}

}